Frame
Check the FrameBase class code on GitLab.
A Frame defines the state of the robot at a given time. Frames in the Trajectory are commonly known as Keyframes.
Each Frame has:
A
std::mapof pointers to state blocks, indexed bychar, with:the extrinsic parameters of
'P'position,'O'orientation,
optionally, more pointers to state blocks defining intrinsic parameters.
'V'velocity,… etc.
A list of Captures.
Frame options
There’s a variety of orthogonal choices in Frames. They concern different aspects:
Dimension: 2D frame, 3D frame
Structure: a string composed of chars are the keys to the state blocks (see above),
"P"Position,"PO"position + orientation,"POV"position + orientation + velocity, used with IMUs.… etc.
These aspects are discussed below.
Frame dimension
Frame dimension is defined at the time of creating the WOLF problem. This means that all frames in a given problem will have the same dimension.
2D frames are for robots evolving in a planar world.
Positions and velocities are 2-vectors.
Orientations are simple angles.
3D frames are for robots evolving in a 3D world.
Positions and velocities are 3-vectors.
Orientations are unit quaternions.
These are all specified with respect to a common reference, that we are going to call here the “Map” reference.
Orientations respond to the most common convention in robotics: local-to-global. This means that:
The angle in 2D, or the quaternion in 3D, specifies the orientation of the robot wrt. the map frame.
Vectors in the local robot frame are transformed to the map frame through one of these mechanisms:
Planar rotation of
aradians,v_map = R(a) * v_robot, whereR(a) = [cos(a) -sin(a) ; sin(a) cos(a)]is a planar rotation matrix.Direct quaternion rotation,
v_map = q * v_robot * q.conjugate, which in c++ Eigen is justv_map = q * v_robot.Through passage to a rotation matrix,
v_map = R(q) * v_robot. In this case we provide the functionq2R()to convert any unit quaternion to a rotation matrix.
Frame structure
The frame structure is defined at the time of creating the WOLF problem. This means that all frames in a given problem will have the same structure.
Frame structures are identified with a string containing one or more of the letters ‘POVW’
"PO"The most common case for a frame is to represent a pose, that is, position “P” and orientation “O”."POV"Frames used in applications containing IMU measurements contain also linear velocity “V”."POVW"Frames that also require angular velocity. These are not yet available in WOLF.
Each of the ‘P’, ‘O’, ‘V’, ‘W’ char parts of the frame structure is
implemented in a differnent state block.
State blocks for ‘P’, ‘V’, ‘W’ are regular state block objects storing vectors of the appropriate dimension.
State blocks for ‘O’ derive from state block:
StateAngle: a scalar limited to [-pi,pi].StateQuaternion: a unit quaternion.
See the StateBlock class documentation for more information.
Frame constructors
We provide three constructors that allow us to enter the information above in different ways, as follows,
FrameBase(const TimeStamp& _ts,
StateBlockPtr _p_ptr,
StateBlockPtr _o_ptr = nullptr,
StateBlockPtr _v_ptr = nullptr);
FrameBase(const TimeStamp& _ts,
const std::string _frame_structure,
const VectorComposite& _state); // State blocks are automatically constructed.
FrameBase(const TimeStamp& _ts,
const std::string _frame_structure,
const std::list<VectorXd>& _vectors); // State blocks are automatically constructed.
For more on the Frame API, check out the FrameBase class code on GitLab.